<?php
session_start();
if(!$_SESSION["trv3_07"]){
	header("location:../login.php");
	exit;
}
require "../resources/v1.php";
// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
if( !get_magic_quotes_gpc()){
	$Autos = addslashes( trim( $_GET['HD12']));
	$Tip = addslashes( trim( $_GET['HD09']));
}else{
	$Autos = trim( $_GET['HD12']);
	$Tip = trim( $_GET['HD09']);
}
$Fecha = $_GET['HD01'];
// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
$conexion = server_reconnect();
$query = 'select `real`,`id`,`sen` from `mul` where `autos`='.$Autos.' and `tip`='.$Tip.' and `activa`=1';
$result = mysql_query( $query, $conexion);
if( $mxcel = @mysql_fetch_array($result)){
	echo '<?xml version="1.0" encoding="iso-8859-1"?><input><HD22>1</HD22>';
	$PAGOS = 0;
	$query = 'select `id`,`realm`,`realf` from cuo where `mul`='.$mxcel['id'].' order by `id`';
	$result = mysql_query( $query, $conexion);
	while( $mxcel2 = @mysql_fetch_array($result)){
		$PAGOS += $mxcel2['realm'];
	}
	$PAGOS = $mxcel['real'] - $PAGOS;
	echo '<CF42>'.$PAGOS.'</CF42><CF43>0'.$mxcel['sen'].'</CF43></input>';
}else{
	echo '<?xml version="1.0" encoding="iso-8859-1"?><input><HD22>0</HD22><CF42>0</CF42><CF43>0</CF43></input>';
}
server_disconnect( $conexion);
?>